#include "ThreadPool.hpp"
#include "Task.hpp"
#include <iostream>
#include <vector>
#include <ctime>
#include <unistd.h>
int main()
{
    srand(time(nullptr) ^ getpid());
    ThreadPool<Task> *tp = new ThreadPool<Task>(5);
    tp->start();

    while (true)
    {
        // 1. 构建任务
        int x = rand() % 10 + 1;
        usleep(10);
        int y = rand() % 5;
        char op = opers[rand()%opers.size()];
        Task t(x, y, op);
        
        tp->push(t);
        std::cout << "make a task: " << t.GetTask() << std::endl;
        usleep(500000);
    }
    return 0;
}